package com.gupaoedu.dubbo.dubboclient;

import com.gupaoedu.dubbo.ISayHelloService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DubboController {

    // Dubbo 提供的注解
    @Reference(loadbalance = "roundrobin", timeout = 2000, cluster = "failfast", mock = "com.gupaoedu.dubbo.dubboclient.SayHelloServiceMock", check = false)
    ISayHelloService sayHelloService; //dubbo://

    @GetMapping("/sayhello")
    public String sayHello() throws InterruptedException {
        // 我调用这个服务可能失败，如果失败了，我要怎么处理
        return sayHelloService.sayHello();
    }


}
